package com.awaken.content.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 功能开关配置属性
 *
 * @author awaken-lin
 */
@Data
@Component
@ConfigurationProperties(prefix = "awaken.features")
public class FeatureProperties {

    /**
     * 数据库功能配置
     */
    private Database database = new Database();

    /**
     * Dubbo RPC功能配置
     */
    private Dubbo dubbo = new Dubbo();

    /**
     * 消息队列功能配置
     */
    private Mq mq = new Mq();

    /**
     * Redis缓存功能配置
     */
    private Redis redis = new Redis();

    /**
     * SSO单点登录功能配置
     */
    private Sso sso = new Sso();

    /**
     * API文档功能配置
     */
    private Swagger swagger = new Swagger();

    /**
     * 监控功能配置
     */
    private Monitor monitor = new Monitor();

    @Data
    public static class Database {
        /**
         * 是否启用数据库功能
         */
        private boolean enabled = true;

        /**
         * 是否显示SQL语句
         */
        private boolean showSql = false;
    }

    @Data
    public static class Dubbo {
        /**
         * 是否启用Dubbo RPC功能
         */
        private boolean enabled = true;

        /**
         * 注册中心类型：nacos, zookeeper, none
         */
        private String registry = "nacos";
    }

    @Data
    public static class Mq {
        /**
         * 是否启用消息队列功能
         */
        private boolean enabled = false;

        /**
         * 消息队列类型：rocketmq, rabbitmq, kafka
         */
        private String type = "rocketmq";
    }

    @Data
    public static class Redis {
        /**
         * 是否启用Redis功能
         */
        private boolean enabled = true;

        /**
         * Redis模式：standalone, cluster, sentinel
         */
        private String mode = "standalone";
    }

    @Data
    public static class Sso {
        /**
         * 是否启用SSO功能
         */
        private boolean enabled = true;
    }

    @Data
    public static class Swagger {
        /**
         * 是否启用Swagger功能
         */
        private boolean enabled = true;
    }

    @Data
    public static class Monitor {
        /**
         * 是否启用监控功能
         */
        private boolean enabled = true;

        /**
         * 包含的监控端点
         */
        private String includeEndpoints = "health,info,metrics";
    }
}
